@extends('backend::layout')

@section('title', '新增机构')

@section('content')
    <form method="post">
        {{ csrf_field() }}
        <div class="box box-primary">
            <div class="box-header with-border">
                <div class="col-lg-4">
                    <h3 class="box-title">新增机构</h3>
                </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body pad-10">
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('type_id')) has-error @endif">
                        <label class="control-label">{{ __("Type") }}：</label>
                        <select class="form-control" name="type_id">
                            <option value="">{{ __('-- Please Selected --') }}</option>
                            @if(!empty($types))
                                @foreach($types as $item)
                                    <option value="{{ $item->id }}" @if(old('type_id') == $item->id ) selected @endif>{{ $item->name }}</option>
                                @endforeach
                            @endif
                        </select>
                        @if($errors->has('type_id'))
                            <span class="help-block">{{ $errors->first('type_id') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('name')) has-error @endif">
                        <label class="control-label">{{ __("Name") }}</label>
                        <input class="form-control " name="name" type="text" placeholder="{{ __("Name") }}" value="{{ old('name') }}">
                        @if($errors->has('name'))
                            <span class="help-block">{{ $errors->first('name') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('username')) has-error @endif">
                        <label class="control-label">{{ __('Account') }}</label>
                        <input class="form-control " name="username" type="text" placeholder="{{ __('Account') }}" value="{{ old('username') }}">
                        @if($errors->has('username'))
                            <span class="help-block">{{ $errors->first('username') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('password')) has-error @endif">
                        <label class="control-label">{{ __('Password') }}</label>
                        <input class="form-control" name="password" type="password" placeholder="{{ __('Password') }}">
                        @if($errors->has('password'))
                            <span class="help-block">{{ $errors->first('password') }}</span>
                        @endif
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('password_confirmation')) has-error @endif">
                        <label class="control-label">{{ __('Confirm Password') }}</label>
                        <input class="form-control" name="password_confirmation" type="password" placeholder="{{ __('Confirm Password') }}">
                        @if($errors->has('password_confirmation'))
                            <span class="help-block">{{ $errors->first('password_confirmation') }}</span>
                        @endif
                    </div>
                </div>

                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('province_id')) has-error @endif">
                        <label class="control-label">{{ __('Address') }}</label>
                        <select class="form-control" name="province_id">
                            <option value="">{{ __('-- Please Selected --') }}</option>
                            @if(!empty($provinces))
                                @foreach($provinces as $item)
                                    <option value="{{ $item->id }}" @if(old('province_id') == $item->id ) selected @endif>{{ $item->name }}</option>
                                @endforeach
                            @endif
                        </select>
                        @if($errors->has('province_id'))
                            <span class="help-block">{{ $errors->first('province_id') }}</span>
                        @endif
                    </div>
                </div>

                <div class="col-lg-4">
                    <div class="form-group @if($errors->has('registered_at')) has-error @endif">
                        <label class="control-label">注册时间</label>
                        <!--<input class="form-control " name="registered_at" type="text" placeholder="注册时间" value="{{ old('registered_at') }}">-->
                        <div class="input-group date form_date" data-date="" data-date-format="yyyy-mm-dd HH:ii:ss" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd HH:ii:ss">
                            <input class="form-control" size="16" type="text" name="registered_at" value="{{ old('registered_at') }}" readonly>
                            <span class="input-group-addon"><span class="fa fa-lg fa-calendar"></span></span>
                        </div>
                        @if($errors->has('registered_at'))
                            <span class="help-block">{{ $errors->first('registered_at') }}</span>
                        @endif
                    </div>
                </div>
            </div>

            <!-- /.box-body -->
            <div class="box-footer m-b-2">
                <div class="col-lg-4">
                    <button class="btn btn-primary btn-sm" type="submit">
                        <i class="fa fa-check"></i> {{ __('Save') }}
                    </button>
                    &nbsp;&nbsp;&nbsp;
                    <a class="btn btn-default btn-sm" href="javascript:history.back(-1);">
                        <i class="fa fa-undo"></i> {{ __('Back') }}
                    </a>
                </div>
            </div>
            <!-- /.box-footer -->
        </div>
    </form>
@stop

@section('script')
    <script>
        !function ($) {
            $(function () {
                $('.form_date').datetimepicker({
                    language:  'zh-CN',
                    weekStart: 1,
                    todayBtn:  1,
                    autoclose: 1,
                    todayHighlight: 1,
                    startView: 2,
                    minView: 2,
                    forceParse: 0
                });
            });
        }(jQuery);

    </script>
@stop